using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class So_FacilitiesEmptyMap : EntityTypeConfiguration<So_FacilitiesEmpty>
    {
        public So_FacilitiesEmptyMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Facility_Name, t.Floor, t.room, t.Gender });

            // Properties
            this.Property(t => t.Facility__)
                .HasMaxLength(6);

            this.Property(t => t.Facility_Name)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.Floor)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.room)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Ward_Name)
                .HasMaxLength(20);

            this.Property(t => t.Gender)
                .IsRequired()
                .HasMaxLength(6);

            this.Property(t => t.Facility_Type)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("So_FacilitiesEmpty");
            this.Property(t => t.Facility__).HasColumnName("Facility_#");
            this.Property(t => t.Facility_Name).HasColumnName("Facility_Name");
            this.Property(t => t.Floor).HasColumnName("Floor");
            this.Property(t => t.room).HasColumnName("room");
            this.Property(t => t.Ward_Name).HasColumnName("Ward_Name");
            this.Property(t => t.Gender).HasColumnName("Gender");
            this.Property(t => t.Facility_Type).HasColumnName("Facility_Type");
        }
    }
}
